{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "61b0bd0c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "9497ba88",
   "metadata": {},
   "outputs": [],
   "source": [
    "ko = json.load(open('./ko_alpaca_data.json'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "20e980c9",
   "metadata": {},
   "outputs": [],
   "source": [
    "en = json.load(open('./en_alpaca_data.json'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8b8431ec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(49620, 52002)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(ko), len(en)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "0e9f5c8e",
   "metadata": {},
   "outputs": [],
   "source": [
    "total = ko + en"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "f3ffc6ae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "101622"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(total)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "c0dc81c9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'instruction': '건강을 유지하기 위한 세 가지 팁을 알려주세요.',\n",
       "  'input': '',\n",
       "  'output': '세 가지 팁은 아침식사를 꼭 챙기며, 충분한 수면을 취하고, 적극적으로 운동을 하는 것입니다.'},\n",
       " {'instruction': '세 가지 기본 색은 무엇인가요?',\n",
       "  'input': '',\n",
       "  'output': '기본 색은 빨강, 파랑, 노랑입니다.'},\n",
       " {'instruction': '원자의 구조를 설명하세요.',\n",
       "  'input': '',\n",
       "  'output': '원자는 양성자, 중성자, 전자로 구성되어 있으며, 양성자와 중성자는 원자핵 안에 있고 전자는 주변에 있습니다.'},\n",
       " {'instruction': '대기 오염을 어떻게 줄일 수 있나요?',\n",
       "  'input': '',\n",
       "  'output': '대기 오염을 줄이기 위해 자동차 대신 대중교통을 이용하고, 미세먼지 배출량을 줄이기 위해 차량 정기 검사를 받아야 합니다. 또한 에너지 절약을 위해 전기를 아끼고, 나무를 심어 대기 오염을 줄일 수 있습니다.'}]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ko[:4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "f0f16f38",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'instruction': 'Give three tips for staying healthy.',\n",
       "  'input': '',\n",
       "  'output': '1.Eat a balanced diet and make sure to include plenty of fruits and vegetables. \\n2. Exercise regularly to keep your body active and strong. \\n3. Get enough sleep and maintain a consistent sleep schedule.'},\n",
       " {'instruction': 'What are the three primary colors?',\n",
       "  'input': '',\n",
       "  'output': 'The three primary colors are red, blue, and yellow.'},\n",
       " {'instruction': 'Describe the structure of an atom.',\n",
       "  'input': '',\n",
       "  'output': 'An atom is made up of a nucleus, which contains protons and neutrons, surrounded by electrons that travel in orbits around the nucleus. The protons and neutrons have a positive charge, while the electrons have a negative charge, resulting in an overall neutral atom. The number of each particle determines the atomic number and the type of atom.'},\n",
       " {'instruction': 'How can we reduce air pollution?',\n",
       "  'input': '',\n",
       "  'output': 'There are a number of ways to reduce air pollution, such as shifting to renewable energy sources, encouraging the use of public transportation, prohibiting the burning of fossil fuels, implementing policies to reduce emissions from industrial sources, and implementing vehicle emissions standards. Additionally, individuals can do their part to reduce air pollution by reducing car use, avoiding burning materials such as wood, and changing to energy efficient appliances.'}]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "en[:4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a3012808",
   "metadata": {},
   "outputs": [],
   "source": [
    "json.dump(total, open('alpaca_data.json', 'w'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d7e16f0d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
